package com.art.coconut.service.impl;

import com.art.coconut.change.ChangePojo;
import com.art.coconut.change.PropertyProcessPojo;
import com.art.coconut.enums.PropertyTypeEnum;
import com.art.coconut.service.IPropertyProcess;

public class BaseProcess implements IPropertyProcess {
    @Override
    public int processObject(PropertyProcessPojo processPojo, ChangePojo changePojo) throws InstantiationException, IllegalAccessException {
        if(processPojo.getTypePojo().getTypeName().equals(PropertyTypeEnum.BASE_TYPE.getTypeName())){
            if(processPojo.getTypePojo().getComparator() != null){
                return processPojo.getTypePojo().getComparator().compare(processPojo.getOld(), processPojo.getCurr());
            }
        }
        return 0;
    }
}
